//  Class: my_transaction
//
class my_transaction extends uvm_sequence_item;
    typedef my_transaction this_type_t;
    `uvm_object_utils(my_transaction);

    //  Group: Variables
    rand bit [47:0] dmac;
    rand bit [47:0] smac;
    rand bit [15:0] ether_type;
    rand byte pload[];
    rand bit [31:0] crc;

    constraint pload_cons{
        pload.size >= 46;
        pload.size <= 1500;
    }

    //  Group: Constraints


    `uvm_object_utils_begin(my_transaction)
    `uvm_field_int(dmac,UVM_ALL_ON)
    `uvm_field_int(smac,UVM_ALL_ON)
    `uvm_field_int(ether_type,UVM_ALL_ON)
    `uvm_field_array_int(pload,UVM_ALL_ON)
    `uvm_field_int(crc,UVM_ALL_ON)
    `uvm_object_utils_end

    //  Group: Functions
    function bit [31:0] calc_crc();
        return 32'h0;
    endfunction

    function void post_randomize();
        crc = calc_crc;
    endfunction

    //  Constructor: new
    function new(string name = "my_transaction");
        super.new(name);
    endfunction: new

    //  Function: do_copy
    // extern function void do_copy(uvm_object rhs);
    //function void my_copy(my_transaction tr);
    //    if(tr==NULL)
    //        `uvm_fatal("my_transaction","tr is NULL")
    //    dmac = tr.dmac;
    //    smac = tr.smac;
    //    ether_type = tr.ether_type;
    //    pload = new[tr.pload.size()];
    //    for(int i=0;i<pload.size();i++)begin
    //        pload[i]=tr.pload[i];
    //    end
    //    crc = tr.crc;
    //endfunction
    //  Function: do_compare
    // extern function bit do_compare(uvm_object rhs, uvm_comparer comparer);
    //function bit my_compare(my_transaction tr);
    //    bit result;
    //    if(tr==NULL)
    //        `uvm_fatal("my_transaction","tr is NULL")
    //    result = ((dmac==tr.dmac)&&(smac==tr.smac)&&(ether_type==tr.ether_type)&&(crc==tr.crc));
    //    if(pload.size()!=tr.pload.size())
    //        result=0;
    //    else
    //        for(int i=0;i<pload.size();i++)begin
    //            if(pload[i]!=tr.pload[i])
    //                result=0;
    //        end
    //    return result;
    //endfunction
    //  Function: convert2string
    // extern function string convert2string();
    //  Function: do_print
    // extern function void do_print(uvm_printer printer);
    //extern function void my_print();
    //  Function: do_record
    // extern function void do_record(uvm_recorder recorder);
    //  Function: do_pack
    // extern function void do_pack();
    //  Function: do_unpack
    // extern function void do_unpack();
    
endclass: my_transaction


/*----------------------------------------------------------------------------*/
/*  Constraints                                                               */
/*----------------------------------------------------------------------------*/




/*----------------------------------------------------------------------------*/
/*  Functions                                                                 */
/*----------------------------------------------------------------------------*/

//function void my_transaction::my_print();
//    $display("dmac=%0h",dmac);
//    $display("smac=%0h",smac);
//    $display("ether_type=%0h",ether_type);
//    for(int i=0;i<pload.size;i++)begin
//        $display("pload[%0d]=%0h",i,pload[i]);
//    end
//    $display("crc=%h",crc);
//endfunction
